package cn.tiasen.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.SeekBar;

public class ProgressBarActivity extends AppCompatActivity {

    private LinearLayout ll_progress_loading;
    private ProgressBar progressBar;
    private SeekBar ss_progress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_progress_bar);

        ll_progress_loading = findViewById(R.id.ll_progress_loading);
        progressBar = findViewById(R.id.progressBar);
        ss_progress = findViewById(R.id.sb_progress);

        ss_progress.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                Log.i("iSeekBar","value:" + String.valueOf(progress));

                progressBar.setProgress(progress);

                if(progress == ss_progress.getMax()){
                    ll_progress_loading.setVisibility(View.INVISIBLE);
                }else{
                    ll_progress_loading.setVisibility(View.VISIBLE);
                }
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });
    }
}
